/* GN base */
if( !GN )
  var GN = {};
GN.checkDroidInterface = function() {
  return typeof(____GN_DROID_INTERFACE____) == 'object';
};
/* Camera Module */
/*
 *   usage: (async)
 *        GN.Camera.requestAndroidPicture( function(imgbuf) {
 *                    // imgbuf => base64 encoded png
 *                         });
 *                         */
if( !GN.hasOwnProperty('Camera') )
  GN.Camera = {};
GN.Camera.onPictureTaken = function(img) {};
GN.Camera.requestAndroidPicture = function(callback) {
  if( !GN.checkDroidInterface() )
    return false;
  if( typeof(callback) == 'function' )
    GN.Camera.onPictureTaken = callback;
  ____GN_DROID_INTERFACE____.requestPicture();
 return false;
};
GN.Camera.receiveAndroidPicture = function(buf) {
  if( typeof(GN.Camera.onPictureTaken) == 'function' )
    GN.Camera.onPictureTaken( buf );
};

/* GPS Module */
/*
 *   usage: (sync)
 *        var latlng = GN.GPS.getLatLng();  // lat,lng or ""
 *        */
if( !GN.hasOwnProperty('GPS') )
  GN.GPS = {};
GN.GPS.getLatLng = function() {
  if( !GN.checkDroidInterface() )
    return "";
  return ____GN_DROID_INTERFACE____.getLatLng();
};
